import {field} from "../../coreModule/data/DataLoader";
import {MainData} from "../../coreModule/data/BaseData";
import {dataClass} from "../../coreModule/managers/DataManager";
import {BaseRepository, getRepository, repository} from "../../coreModule/data/BaseRepository";
import {Constructor} from "../../../utils/BaseContext";

@dataClass("Banner")
export class Banner extends MainData {

	@field(String)
	public pictureUrl: string;

	@field(String)
	public content:string;

	// // region 额外数据
	//
	// tempPictureUrl: string;
	//
	// /**
	//  * 刷新数据
	//  */
	// public async refresh() {
	// 	const res = await wx.cloud.getTempFileURL({
	// 		fileList: [this.pictureUrl]
	// 	});
	// 	this.tempPictureUrl = res.fileList[0].tempFileURL;
	// }
	//
	// // endregion
}

export function bannerRepo() {
	return getRepository(BannerRepo);
}

@repository
export class BannerRepo extends BaseRepository<Banner> {

	get clazz(): Constructor<Banner> { return Banner; }
	public constructor() { super(); }

}
